﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Quizz.DataRepository.Models;
using Quizz.QuizzProjectService.Models;

namespace Quizz.QuizzProjectService
{
    [ServiceContract]
    public interface IQuizzProjectService
    {
        [OperationContract]
        void DoWork();

        #region User
        [OperationContract]
        User UserGetById(long id);

        [OperationContract]
        IList<User> UserGetAll();

        [OperationContract]
        User UserGetByEmail(string email);

        [OperationContract]
        IList<User> UserGetByRole(long role);

        [OperationContract]
        void UserInsert(User user);

        [OperationContract]
        void UserUpdate(User user);

        [OperationContract]
        bool UserDelete(long id);

        [OperationContract]
        bool UserIsEmailAvailable(string email);

        [OperationContract]
        UserPageResult UserGetPage(int page, int count, string orderCol);

        [OperationContract]
        UserPageResult UserGetPageSearch(int page, int count, string orderCol, string keyword);

        #endregion

        #region LoginLog

        [OperationContract]
        LoginLog LoginLogGetById(long id);

        [OperationContract]
        LoginLog LoginLogGetBySessionId(string sessionId);
        
        [OperationContract]
        void LoginLogInsert(LoginLog log);

        [OperationContract]
        void LoginLogUpdate(LoginLog log);

        [OperationContract]
        void LoginLogDelete(long id);

        [OperationContract]
        LoginLog LoginLogGetLastLogin(long userid);

        [OperationContract]
        int LoginLogGetNumberOfLogin(DateTime date);

        [OperationContract]
        IList<LoginLog> LoginLogGetLogs(DateTime fromDate, DateTime toDate);

        [OperationContract]
        IList<LoginLog> LoginLogGetUserLogs(long userId);

        #endregion

        #region Menu

        [OperationContract]
        Menu MenuGetById(long id);

        [OperationContract]
        IList<Menu> MenuGetAllParent();

        [OperationContract]
        IList<Menu> MenuGetChilds(long? parentId);

        [OperationContract]
        IList<Menu> MenuGetParentForRole(long role);

        [OperationContract]
        IList<Menu> MenuGetChildForRole(long? parent, long role);

        [OperationContract]
        IList<Menu> MenuGetAllForRole(long role);

        [OperationContract]
        IList<Menu> MenuGetForAnonymous();
        
        [OperationContract]
        void MenuDelete(long id);

        [OperationContract]
        void MenuInsert(Menu menu);

        [OperationContract]
        void MenuUpdate(Menu menu);

        [OperationContract]
        Menu MenuGetByUrl(string baseUrl);

        #endregion

        #region Role
        [OperationContract]
        Role RoleGetById(long id);

        [OperationContract]
        IList<Role> RoleGetAll();
        #endregion

        #region Property
        [OperationContract]
        Property PropertyGetById(long id);

        [OperationContract]
        IList<Property> PropertyGetAll();

        [OperationContract]
        IList<Property> PropertyGetByType(int type);

        [OperationContract]
        Property PropertyGetByName(string name);

        [OperationContract]
        void PropertyInsert(Property property);

        [OperationContract]
        void PropertyUpdate(Property property);

        [OperationContract]
        void PropertyDelete(long id);
        #endregion

        #region Question

        [OperationContract]
        Question QuestionGetById(long id);

        [OperationContract]
        IList<Question> QuestionGetAllForUser(long userId, string orderCols);

        [OperationContract]
        IList<Question> QuestionGetAllForUserPage(long userId, int page, int count, string orderCols);

        [OperationContract]
        void QuestionInsert(Question question);
        
        [OperationContract]
        void QuestionUpdate(Question question);

        [OperationContract]
        bool QuestionDelete(long id);

        [OperationContract]
        QuestionPageResult QuestionGetPage(long userId, long subjectId, int page, int count, string orderCol);

        #endregion

        #region Subject

        [OperationContract]
        Subject SubjectGetById(long id);

        [OperationContract]
        IList<Subject> SubjectGetAll();

        #endregion
    }
}
